package com.fast.tcc.config;

import com.fast.tcc.controller.TccResponseErrorHandler;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @Auther: wangzun
 * @Date: 2018/9/14 15:16
 * @Description: Bean装配
 */
@Configuration
public class BeanConfiguration {

    @LoadBalanced
    @Bean
    public RestTemplate restTemplate() {
        final RestTemplate restTemplate = new RestTemplate();
        restTemplate.setErrorHandler(new TccResponseErrorHandler());
        return restTemplate;
    }
}
